#ifndef GOAT3DGFX_VR_H_
#define GOAT3DGFX_VR_H_

/* VR mode init options */
enum vr_init_mode {
	VR_INIT_NONE,
	VR_INIT_OCULUS,
	VR_INIT_STEREO
};

/* possible eye values */
enum {
	VR_EYE_CENTER,
	VR_EYE_LEFT,
	VR_EYE_RIGHT
};

#ifdef __cplusplus
extern "C" {
#endif

int vr_init(enum vr_init_mode mode);
void vr_shutdown(void);

const char *vr_get_display_name(void);
void vr_get_display_pos(int *xptr, int *yptr);

int vr_get_width(void);
int vr_get_height(void);

float vr_get_fov(void);
float vr_get_aspect(void);

void vr_set_eyedist(float ipd);
float vr_get_eyedist(void);

/* expects an array of 4 barrel distortion coefficients:
 * polar scale: k_0 + k_1 r^2 + k_2 r^4 + k_3 r^6
 */
void vr_set_distort(const float *coef);
void vr_get_distort(float *coef);

void vr_set_prediction_sec(float dt);
float vr_get_prediction_sec(void);

void vr_get_view_matrix(float *res, int eye);
void vr_get_proj_matrix(float *res, int eye);

/* expects an array of at least 3 floats (x, y, z, offset). */
void vr_get_translation(float *offs);
/* expects an array of at least 4 floats (x, y, z, w, quaternion). */
void vr_get_rotation(float *quat);
/* expects an array of at least 3 floats (pitch, yaw, roll, angles). */
void vr_get_rotation_euler(float *euler);

/* OpenGL stuff */
void vr_draw_eye(int eye, unsigned int tex, float tex_scale_x, float tex_scale_y);

#ifdef __cplusplus
}
#endif

#endif	/* GOAT3DGFX_VR_H_ */
